/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"CB24D91E-3343-4F31-8DDA-D016E3FE89A0",variableType:4}
 */
var $historico = 0;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"FB461B50-A9DE-4689-8320-FE355F2AE0C2",variableType:4}
 */
var $historico_listado_localidades = 1;

/**
 * @properties={typeid:24,uuid:"A51C7A78-639B-41EA-AF6D-32563305A5C2"}
 */
function doEdit(){
	
	elements.btn_ir_pais.visible = false;
	elements.btn_borrar_pais.visible = true;
	
	elements.historicos.enabled = false;
	elements.btn_alta_historicos.enabled = false;
	elements.btn_menu_historicos.enabled = false;
	elements.tab_historicos.enabled = false;
	controller.focusField(elements.fld_s_descripcion.getName(),true);
}

/**
 * @properties={typeid:24,uuid:"74F9E8AD-CA83-4C71-A52A-C8F4C7B5055F"}
 */
function hide_btn_reset_fields(){
	
	elements.btn_ir_pais.visible = true;
	elements.btn_borrar_pais.visible = false;
	
	elements.historicos.enabled = true;
	elements.btn_alta_historicos.enabled = true;
	elements.btn_menu_historicos.enabled = true;
	elements.tab_historicos.enabled = true;
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E6F166F1-95B4-4C6F-8166-A312E67586AD"}
 */
function historico_opciones(event) {
	// TODO Auto-generated method stub
}

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @private
 *
 * @properties={typeid:24,uuid:"8A009250-32EB-45AC-86ED-C3B859D75861"}
 */
function onDataChangeHistorico(oldValue, newValue, event) {

	elements.tab_historicos.removeAllTabs();
	if  ($historico == $historico_listado_localidades){
//		elements.tab_historicos.addTab(forms.lst_adm_t900_usuarios_h,null,null,null,null,null,null, adm_t900_empresas_to_adm_t900_usuarios);
	}
	return true
}

/**
 * Callback method for when form is shown.
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 * @private
 * @properties={typeid:24,uuid:"78DB07E5-872A-4F94-A21D-319B4060986C"}
 */
function onShow(firstShow, event) {

	if (foundset.getSelectedRecord().isNew()){
		elements.tab_historicos.visible = false;
	}else{
		
		var dataset = databaseManager.createEmptyDataSet(0,new Array('display_values','optional_real_values'));
		dataset.addRow(['LISTADO DE LOCALIDADES', $historico_listado_localidades]);
		elements.historicos.setValueListItems(dataset);
		
		elements.tab_historicos.visible = true;
		elements.tab_historicos.removeAllTabs();
		$historico = $historico_listado_localidades;
//		elements.tab_historicos.addTab(forms.lst_adm_t300_apli_emp__emp_h,null,null,null,null,null,null,adm_t900_aplicaciones_to_adm_t300_apli_emp);
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"BF7E79F4-3068-40E7-91FC-DE561C6BD050"}
 */
function historico_alta(event) {

	if ($historico == $historico_listado_localidades){
//		globals.ir_formulario(event, forms.frm_adm_t900_usuarios.controller.getName(), null,  globals.$MODO_ALTA,ds);
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 * @properties={typeid:24,uuid:"4DFC93AE-20A8-46A8-96BD-AAF6FF0A6E20"}
 */
function borrar_pais(event) {

	app_t200_paises_id = null;
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 * @properties={typeid:24,uuid:"79834241-A79B-47F1-93EF-1484BD274D01"}
 */
function ir_pais(event) {

	globals.ir_formulario(event,forms.frm_app_t200_paises.controller.getName(),app_t200_localidades_to_app_t200_paises,globals.$MODO_LECTURA);
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 * @properties={typeid:24,uuid:"5533ABEA-AEC2-4E47-BE28-24755A2DF924"}
 */
function ir_provincia(event) {
	
	globals.ir_formulario(event,forms.frm_app_t200_provincias.controller.getName(),app_t200_localidades_to_app_t200_provincias,globals.$MODO_LECTURA);
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @private
 *
 * @properties={typeid:24,uuid:"A6B231B5-F7C4-4402-BD3C-5C66AD3A64B9"}
 */
function borrar_provincia(event) {
	
	app_t200_provincias_id = null;
}
